package com.cfec.educationplatform.Controller;

import com.cfec.educationplatform.service.BetPraHistoryResultService;
import com.cfec.educationplatform.service.impl.BetPraHistoryResultServiceImpl;
import com.cfec.educationplatform.util.ResultData;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/practice")
@ApiOperation("练习功能")
@Slf4j
public class PracticeController {

    @Resource(name = "betPraHistoryResultServiceImpl")
    BetPraHistoryResultServiceImpl betPraHistoryResultService;

    @ApiOperation("/获取练习历史")
    @GetMapping("/getHistory")
    public ResultData<Object> getHistory(Long userId){
        log.info("userId:"+userId);
        return betPraHistoryResultService.getHistory(userId);
    }

    @ApiOperation("/获取题目详情")
    @GetMapping("/getTopicInfo")
    public ResultData<Object> getTopicInfo(Long userId){
        log.info("topicId:"+userId);
        return betPraHistoryResultService.getTopicInfo(userId);
    }

    @ApiOperation("/获取练习历史的细分")
    @GetMapping("/GetPraHistoryDetails")
    public ResultData<Object> GetPraHistoryDetails(Long historyId){
        return betPraHistoryResultService.GetPraHistoryDetails(historyId);
    }
}
